def getBitsFromNum(num, bitsPerComponent=8):
    """
        Makes the conversion between number and bits

        @param num: Number to be converted
        @param bitsPerComponent: Number of bits needed to represent a component
        @return: A tuple (status,statusContent), where statusContent is the string containing the resulting bits in case status = 0 or an error in case status = -1
    """
    if not isinstance(num, int):
        return -1, 'num must be an integer'
    if not isinstance(bitsPerComponent, int):
        return -1, 'bitsPerComponent must be an integer'
    try:
        bitsRepresentation = bin(num)
        bitsRepresentation = bitsRepresentation.replace('0b', '')
        mod = len(bitsRepresentation) % 8
        if mod != 0:
            bitsRepresentation = '0' * (8 - mod) + bitsRepresentation
        bitsRepresentation = bitsRepresentation[-1 * bitsPerComponent:]
    except:
        return -1, 'Error in conversion from number to bits'
    return 0, bitsRepresentation
