#!/usr/bin/env python
# encoding=utf-8

from api.models import PLATFORM_CHOICES


def get_device_id(platform, idfa, mac, device_id):
    _device_id = None
    if not platform: return _device_id

    if platform == PLATFORM_CHOICES.IPHONE:
        if idfa:
            _device_id = idfa

        elif mac:
            _device_id = mac

    elif platform == PLATFORM_CHOICES.ANDROID and device_id:
        _device_id = device_id

    return _device_id
