def parse_uid(uid):
    """
    Parse UID string.

    :return: (ResourceType, uid_remainder)
    :rtype: ``tuple``
    """
    if UIDFieldMixin.UID_SEPARATOR not in uid:
        raise ValueError("Invalid uid: %s" % (uid))

    parsed = uid.split(UIDFieldMixin.UID_SEPARATOR)

    if len(parsed) < 2:
        raise ValueError("Invalid or malformed uid: %s" % (uid))

    resource_type = parsed[0]
    uid_remainder = parsed[1:]

    return (resource_type, uid_remainder)

    Parse UID string.

    :return: (ResourceType, uid_remainder)
    :rtype: ``tuple``
    
st2common/st2common/util/uid.py