from datetime import datetime
import pytz


def _format_datetime(utc_float):
    """Method ingests a utc timestamp float and formats it into
    a datetime format that is prefered by the DRF framework.
    It performs conversions through datetime and pytz.
    Args:
        utc (float): A unix timestamp.   
        
    Returns:
        str: The formatted datetime in string format.
    """
    date_obj = datetime.fromtimestamp(utc_float, tz=pytz.utc)
    date_str = date_obj.strftime("%Y-%m-%dT%H:%M:%S.%f%z")

    return date_str