import platform
import pwd


def GetUserId(user):
    """
    On a Linux system attempt to get the UID value for a give 'user'. This uses
    a system call to obtain this data.

    :param user: User name to lookup.
    :return: UID value if the user is found, otherwise None
    """
    if isinstance(user, int):
        return user
    if platform.system() != 'Linux':
        raise RuntimeError('UID lookup not support outside of Linux')
    try:
        return pwd.getpwnam(user).pw_uid
    except KeyError:
        return None