get the first element of a list

        >>> lst = [1, 2, 3, 4, 5]
        >>> first(lst)
        1
        >>> first(lst, 3)
        [1, 2, 3]
        >>> first(lst, 10)
        [1, 2, 3, 4, 5]
        >>> first({"key": "value"})
        {'key': 'value'}
        >>> first(("a", "b", "c"))
        'a'
        >>> first([''])
        ''
        >>> first([''], 5)
        ['']
        >>> first(['', ''])
        ''
        >>> first(False)
        False
        >>> first("")
        ''
        >>> first(None)
        >>> first([])

def first(thing, n=0):
    """ get the first element of a list

        >>> lst = [1, 2, 3, 4, 5]
        >>> first(lst)
        1
        >>> first(lst, 3)
        [1, 2, 3]
        >>> first(lst, 10)
        [1, 2, 3, 4, 5]
        >>> first({"key": "value"})
        {'key': 'value'}
        >>> first(("a", "b", "c"))
        'a'
        >>> first([''])
        ''
        >>> first([''], 5)
        ['']
        >>> first(['', ''])
        ''
        >>> first(False)
        False
        >>> first("")
        ''
        >>> first(None)
        >>> first([])
    """
    n = to_int(n)
    if is_list(thing) or is_tuple(thing):
        if len(thing) == 0:
            return None
        if n > 0:
            return thing[0:n]
        return thing[0]
    return thing