def fleet_id_to_slug(did):
    """ Converts a fleet id into a correct fleet slug.

    Args:
        did (long) : A fleet id
        did (string) : A device slug in the form of XXXX, XXXX-XXXX-XXXX, g--XXXX, g--XXXX-XXXX-XXXX
    Returns:
        str: The device slug in the g--XXXX-XXXX-XXX format
    Raises:
        ArgumentError: if the ID is not in the [1, 16**12] range, or if not a valid string
    """

    try:
        fleet_slug = IOTileFleetSlug(did)
    except ValueError:
        raise ArgumentError("Unable to recognize {} as a fleet id".format(did))

    return str(fleet_slug)