Converts a state's name, postal abbreviation or FIPS to A.P. style.
    
    Example usage:
    
        >> ap_state("California")
        'Calif.'

def ap_state(value, failure_string=None):
    """
    Converts a state's name, postal abbreviation or FIPS to A.P. style.
    
    Example usage:
    
        >> ap_state("California")
        'Calif.'
    
    """
    try:
        return statestyle.get(value).ap
    except:
        if failure_string:
            return failure_string
        else:
            return value